import request from '@/utils/request'

// 查询公告列表
export function listAnnouncement(query) {
  return request({
    url: '/announcement/announcement/list',
    method: 'get',
    params: query
  })
}

// 查询公告详细
export function getAnnouncement(noticeId) {
  return request({
    url: '/announcement/announcement/' + noticeId,
    method: 'get'
  })
}
// 更新公告状态
export function updateAnnouncementStatus(noticeId, status) {
  return request({
    url: `/announcement/announcement/updateStatus/${noticeId}`,
    method: 'put',
    data: { status }
  });
}
// 新增公告
export function addAnnouncement(data) {
  return request({
    url: '/announcement/announcement',
    method: 'post',
    data: data
  })
}

// 修改公告
export function updateAnnouncement(data) {
  return request({
    url: '/announcement/announcement',
    method: 'put',
    data: data
  })
}

// 删除公告
export function delAnnouncement(noticeId) {
  return request({
    url: '/announcement/announcement/' + noticeId,
    method: 'delete'
  })
}
